﻿using Abp.Application.Features;
using Abp.Localization;

namespace Mt.Site.Core.Members.Features
{
    class MemberFeatureProvider: FeatureProvider
    {
        public override void SetFeatures(IFeatureDefinitionContext context)
        {
            var memberFeature = context.Create(
                                MemberFeatures.MemberFeature,
                                defaultValue: "true",
                                displayName: L("MemberFeature")
                            );

            memberFeature.CreateChildFeature(
                                MemberFeatures.MemberInfoLocalization,
                                defaultValue: "false",
                                displayName: L("MemberInfoLocalization")
                            );
            memberFeature.CreateChildFeature(
                    MemberFeatures.MemberSecurityStampFeature,
                    defaultValue: "false",
                    displayName: L("MemberSecurityStampFeature")
                );

            memberFeature.CreateChildFeature(
                                MemberFeatures.MemberRegisterFeature,
                                defaultValue: "true",
                                displayName: L("MemberRegister")
                            );
            memberFeature.CreateChildFeature(
                    MemberFeatures.MemberChangeEmailFeature,
                    defaultValue: "true",
                    displayName: L("MemberChangeEmail")
                );
            memberFeature.CreateChildFeature(
                                MemberFeatures.MemberChangeUserNameFeature,
                                defaultValue: "true",
                                displayName: L("MemberChangeUserName")
                            );
            memberFeature.CreateChildFeature(
                    MemberFeatures.MemberUpdateMemberInfoFeature,
                    defaultValue: "true",
                    displayName: L("MemberUpdateMemberInfo")
                );
            memberFeature.CreateChildFeature(
                                MemberFeatures.MemberResetPasswordFeature,
                                defaultValue: "true",
                                displayName: L("MemberResetPassword")
                            );
        }

        private static ILocalizableString L(string name)
        {
            return new LocalizableString(name, MtSiteConsts.LocalizationSourceName_Feature);
        }
    }
}
